package com.ztorn.common.model;

import com.ztorn.common.assertion.Asserts;

public enum ProcessType {

    FLINK_EXPLAIN("FlinkExplain"),
    FLINK_EXECUTE("FlinkExecute"),
    FLINK_SUBMIT("FlinkSubmit"),
    SQL_EXPLAIN("SQLExplain"),
    SQL_EXECUTE("SQLExecute"),
    SQL_SUBMIT("SQLSubmit"),
    LINEAGE("Lineage"),
    UNKNOWN("Unknown");

    private String value;

    ProcessType(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public static ProcessType get(String value) {
        for (ProcessType type : ProcessType.values()) {
            if (Asserts.isEquals(type.getValue(), value)) {
                return type;
            }
        }
        return ProcessType.UNKNOWN;
    }

    public boolean equalsValue(String type) {
        if (Asserts.isEquals(value, type)) {
            return true;
        }
        return false;
    }
}
